package io.sage.modules.basics.service.impl;

import io.sage.modules.basics.entity.BLocation;
import io.sage.modules.basics.dao.BLocationMapper;
import io.sage.modules.basics.service.BLocationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 位置管理
(BLocation)表服务实现类
 *
 * @author zxh
 * @since 2019-08-10 09:19:53
 */
@Service("bLocationService")
public class BLocationServiceImpl implements BLocationService {
    @Resource
    private BLocationMapper bLocationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BLocation queryById(Integer id) {
        return this.bLocationMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BLocation> queryAllByLimit(int offset, int limit) {
        return this.bLocationMapper.queryAllByLimit(offset, limit);
    }
    /**
     * 查询多条数据
     *
     * @param bLocation
     * @return 对象列表
     */
    @Override
    public List<BLocation> queryAll(BLocation bLocation) {
        return this.bLocationMapper.queryAll(bLocation);
    }

    /**
     * 新增数据
     *
     * @param bLocation 实例对象
     * @return 实例对象
     */
    @Override
    public BLocation insert(BLocation bLocation) {
        this.bLocationMapper.insert(bLocation);
        return bLocation;
    }

    /**
     * 修改数据
     *
     * @param bLocation 实例对象
     * @return 实例对象
     */
    @Override
    public BLocation update(BLocation bLocation) {
        this.bLocationMapper.update(bLocation);
        return this.queryById(bLocation.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bLocationMapper.deleteById(id) > 0;
    }
    /**
     * 通过主键批量删除数据
     *
     * @param asList 主键数组
     * @return 是否成功
     */
    @Override
    public int deleteBatchIds(List<Integer> asList) {
        return this.bLocationMapper.deleteBatchIds(asList);
    }

    @Override
    public List<BLocation> queryByMap(HashMap<String, Object> paramMap) {
        return this.bLocationMapper.queryByMap(paramMap);
    }


}